#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>


typedef signed int __int32_t;
typedef unsigned int __uint32_t;

#define UART_IOC_MAGIC   'u'
#define UART_CFG_BAUDRATE _IO(UART_IOC_MAGIC, 1)
#define UART_CFG_ATTR     _IOW(UART_IOC_MAGIC, 5, __int32_t)



int main (int argc,char **argv)
{

    /*设置模式下拔掉n1插口，必须波特率9600才能访问*/
    printf("\n*************************\n");
    int fd,ret;
    int size;
    unsigned char buff_r[20]={0};
    char buff[]={0xc1,0x00,0x09};//读取内部设置
    char buf_set1[4]={0xc0,0x01,0x01,0x12};//设置地址为0x12
    char lds_buf[]={0xcf,0xcf,0xc1,0x00,0x09};//读取无线配置（点对点下的节点）
    
    fd=open("/dev/uartdev-7",O_RDWR);
    ioctl(fd,UART_CFG_BAUDRATE,9600);
    /*发送读取内设置的命令*/
    write(fd,buff,3);
    printf("write ok\n ");
    size=read(fd,buff_r,20);//读取返回值
    printf("read size%d\n",size);
    printf("111111%s\r\n",buff_r);
    for(int a=0;a<size;a++){
        printf("buf[%d]=%x  ",a,buff_r[a]);
    }

    ret = close(fd);

}
